package net.zoneland.zrdp.web.impl;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import net.zoneland.springboot.redis.AppPublishService;
import net.zoneland.zrdp.framework.web.service.TokenDeleteNotifyProvider;

@Component
public class TokenDeleteNotifyProviderImpl implements TokenDeleteNotifyProvider {

    @Autowired (required = false)
    private AppPublishService appPublishService;

    @Override
    public void doAfterDeleteToken(final HttpServletRequest request, final String token) {
        if (appPublishService == null) {
            return;
        }
        appPublishService.sendMsg(request, "clean-session-bytoken:" + token);
    }

}
